package com.caizongzhen.www.util;

import java.util.regex.Pattern;

public class VerifyFormat {
    /*
    * 邮箱正则表达式
    * "^[A-Za-z0-9+_.-]+@[A-Za-z0-9.-]+$"
    *"^\\w+([-+.]\\w+)*@\\w+([-.]\\w+)*\\.\\w+([-.]\\w+)*$"
     */
    private static final String emailRegex = "^[A-Za-z0-9\\u4e00-\\u9fa5]+(\\.[A-Za-z0-9\\u4e00-\\u9fa5]+)*@[A-Za-z0-9\\u4e00-\\u9fa5]+(\\.[A-Za-z0-9\\u4e00-\\u9fa5]+)*(\\.[A-Za-z\\u4e00-\\u9fa5]{2,})$";
    /*
    * 手机号码正则表达式
    *
    * */
    private static final String mobileRegex = "^(13[0-9]|15[0|3|6|7|8|9]|18[8|9])\\d{8}$";
    private static Pattern pattern;
    public static boolean verifyFormatEmail(String email){
        pattern = Pattern.compile(emailRegex);
        return pattern.matcher(email).matches();
    }
    public static boolean verifyFormatMobile(String mobile){
        pattern = Pattern.compile(mobileRegex);
        return pattern.matcher(mobile).matches();
    }
}
